/*
 * @(#)Group.java
 * 
 * Create Version: 1.0.0
 * Author: James Liu
 * Create Date: 2009-12-09
 * 
 * Copyright (c) 2009 ASPire Information Technologies Ltd. All Right Reserved.
 */
package com.aspire.boc.mms.wmf.cam;


import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;


/**
 * CAM value object.
 * 
 * @version 1.0.0   2009-12-09
 * @author  James Liu
 */
public class Group implements Serializable {
    
    private static final long serialVersionUID = 974936858555445914L;
    
    private int id;
    private String name;
    private String administrator;
    private int level;
    private Integer parentId;
    private Group parent;
    private String systemDef;
    private String desc;
    
    private Set<Group> children = new LinkedHashSet<Group>();
    private Set<User> users = new LinkedHashSet<User>();
    private Set<Role> roles = new LinkedHashSet<Role>();
    
    
    public int getId() {
    
        return id;
    }
    
    public void setId(int id) {
    
        this.id = id;
    }
    
    public String getName() {
    
        return name;
    }
    
    public void setName(String name) {
    
        this.name = name;
    }
    
    public String getAdministrator() {
    
        return administrator;
    }
    
    public void setAdministrator(String administrator) {
    
        this.administrator = administrator;
    }
    
    public int getLevel() {
    
        return level;
    }
    
    public void setLevel(int level) {
    
        this.level = level;
    }
    
    public Integer getParentId() {
    
        return parentId;
    }
    
    public void setParentId(Integer parentId) {
    
        this.parentId = parentId;
    }
    
    public Group getParent() {
    
        return parent;
    }
    
    public void setParent(Group parent) {
    
        this.parent = parent;
    }
    
    public String getSystemDef() {
    
        return systemDef;
    }
    
    public void setSystemDef(String systemDef) {
    
        this.systemDef = systemDef;
    }
    
    public String getDesc() {
    
        return desc;
    }
    
    public void setDesc(String desc) {
    
        this.desc = desc;
    }
    
    public Set<Group> getChildren() {
    
        return children;
    }
    
    public void setChildren(Set<Group> children) {
    
        this.children = children;
    }
    
    public Set<User> getUsers() {
    
        return users;
    }
    
    public void setUsers(Set<User> users) {
    
        this.users = users;
    }
    
    public Set<Role> getRoles() {
    
        return roles;
    }
    
    public void setRoles(Set<Role> roles) {
    
        this.roles = roles;
    }
    
    public String toString() {
        
        StringBuilder result = new StringBuilder();
        
        result.append("Group[id=")
              .append(this.getId())
              .append(", name=")
              .append(this.getName())
              .append(", administrator=")
              .append(this.getAdministrator())
              .append(", level=")
              .append(this.getLevel())
              .append(", parentId=")
              .append(this.getParentId())
              .append(", systemDef=")
              .append(this.getSystemDef())
              .append(", desc=")
              .append(this.getDesc())
              .append(", subGroupCount=")
              .append(this.getChildren().size())
              .append(", userCount=")
              .append(this.getUsers().size())
              .append(", roleCount=")
              .append(this.getRoles().size())
              .append("]");
        
        return result.toString();
    }
}